const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('as4KDotsCostChanges', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "编号"
    },
    create_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "创建时间"
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "更新时间"
    },
    stock_code: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "代码"
    },
    stock_name: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "名字"
    },
    highest_price: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "最高价"
    },
    lowest_price: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "最低价"
    },
    mid_price: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "中间价"
    },
    fall_price_percentage: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "回调幅度"
    },
    up_price_percentage: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "反弹幅度"
    },
    origin_cost: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "原始成本"
    },
    origin_count: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "原始数量"
    },
    current_price: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "当前价格"
    },
    add_count: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "增加数量"
    },
    add_amount: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "增加金额"
    },
    new_price_plus: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "加仓成本"
    },
    new_count_plus: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "加仓数量"
    },
    new_price_minus: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "建仓成本"
    },
    new_count_minus: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "建仓数量"
    },
    user_id: {
      type: DataTypes.INTEGER,
      allowNull: false
    }
  }, {
    sequelize,
    tableName: 'as4k_dots_cost_changes',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
